﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


    public class PointComparer : IComparer<Point>
    {
        private Point pivotPoint;

        public PointComparer(Point pivotPoint)
        {
            this.pivotPoint = pivotPoint;
        }

        public int Compare(Point firstPoint, Point secondPoint)
        {
            int crossProduct = 
                Point.CalculateCrossProduct(
                    this.pivotPoint, firstPoint, secondPoint);

            int result = -1;
            if (crossProduct >= 0)
            {
                result = 1;
            }
            else
            {
                //if (crossProduct == 0)
                //{
                //    result = 0;
                //}
                //else
                //{
                    //crossProduct < 0
                    result = -1;
                //}
            }
            return result;
        }
    }

